package spring.yongongsystem.controller.merchant;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import spring.yongongsystem.POJO.dto.CategoryPageQueryDTO;
import spring.yongongsystem.POJO.entity.Category;
import spring.yongongsystem.result.PageResult;
import spring.yongongsystem.result.Result;
import spring.yongongsystem.service.CategoryService;

@RestController("merchantCategoryController")
@RequestMapping("/merchant/category")
@Api(tags = "商家分类相关接口")
@Slf4j
public class CategoryController {

    @Autowired
    private CategoryService categoryService;

    /**
     * 分类分页查询
     * @param categoryPageQueryDTO
     * @return
     */
    @GetMapping("/page")
    @ApiOperation("分类分页查询")
    public Result<PageResult> page(CategoryPageQueryDTO categoryPageQueryDTO){
        log.info("分页查询：{}", categoryPageQueryDTO);
        PageResult pageResult = categoryService.pageQuery(categoryPageQueryDTO);
        return Result.success(pageResult);
    }

}
